Conversation
|
Review requested:
|
669757d to
c6558b0
Compare
| [`setTimeout()`][] and [`setInterval()`][] APIs return a number, which cannot | ||
| implement `Symbol.dispose`. Prefer [`clearTimeout()`][] instead to cancel a | ||
| timeout. This deprecation does not apply to [`Immediate`][] objects returned by | ||
| [`setImmediate()`][]. |
There was a problem hiding this comment.
since this deprecation have clear before after change could you add code snippets to that.
|
Added before/after code snippets to DEP0208 as requested. |
Add code examples showing migration from Timeout.prototype[Symbol.dispose] to clearTimeout(). Refs: nodejs#64615 Signed-off-by: Matteo Collina <hello@matteocollina.com>
Web or not, I'd add a +1 for deprecating this as well for consistency, are there any real uses for disposing of an Immediate in the same block as it was created? https://github.com/search?q=language%3AJavaScript+%2Fusing+%5CS%2B+%3D+setImmediate%2F&type=code |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #64615 +/- ##
==========================================
- Coverage 90.29% 90.28% -0.02%
==========================================
Files 790 790
Lines 271882 271883 +1
Branches 51899 51906 +7
==========================================
- Hits 245485 245456 -29
- Misses 16888 16931 +43
+ Partials 9509 9496 -13
🚀 New features to boost your workflow:
|
AugustinMauroy
left a comment
There was a problem hiding this comment.
in term of docs it's super nice.
and in terms of the deprecation LGTM
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
aduh95
left a comment
There was a problem hiding this comment.
I would be interested to see this API back in a web-compat way, but in the mean time deprecating makes sense
Emit a DEP0210 deprecation warning when Timeout.prototype[Symbol.dispose] is called. The web platform setTimeout()/setInterval() APIs return a number, which cannot implement Symbol.dispose. Prefer clearTimeout() instead. Immediate.prototype[Symbol.dispose] is left unchanged. Fixes: nodejs#58689 Signed-off-by: Matteo Collina <hello@matteocollina.com>
Add code examples showing migration from Timeout.prototype[Symbol.dispose] to clearTimeout(). Refs: nodejs#64615 Signed-off-by: Matteo Collina <hello@matteocollina.com>
13422f2 to
5c53996
Compare
Emit a DEP0208 runtime deprecation warning when
Timeout.prototype[Symbol.dispose]is called.The web platform
setTimeout()/setInterval()APIs return a number,which cannot implement
Symbol.dispose. Leaving this integration in placeencourages code that is incompatible between Node.js and browsers (and
other server-side platforms that follow the web timers API).
Immediate.prototype[Symbol.dispose]is intentionally left unchanged,since
setImmediateis not a web platform API.Prefer
clearTimeout()to cancel a timeout.Fixes: #58689